/* 设备管理-设备维护（管理员）api */

import { ajaxService } from '@/utils/request';
import { number } from 'echarts/core';

const env = import.meta.env;
let baseURL = env.VITE_EQUIPMENT_URL;
// let baseURL = 'http://192.168.0.120:8086';

// 获取维修列表数据
export function GetFaultEquipmentList(params: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/list/page',
    method: 'get',
    baseURL,
    params,
  });
}

// 新增设备维修单
export function PostFaultEquipment(data: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/list/add',
    method: 'post',
    baseURL,
    data,
  });
}

// 编辑设备维修单
/**
 *
 * @param data repairState 维修状态 1.待派工；2.待维修；3.进行中；4.需委外.5.已委外；6.已完工
 * @returns
 */
export function PutFaultEquipment(data: { repairState: number } | any) {
  return ajaxService({
    url: '/equipment/maintain/repair/list/edit',
    method: 'put',
    baseURL,
    data,
  });
}

// 新增设备维修单
export function DelFaultEquipment(params: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/list',
    method: 'delete',
    baseURL,
    params,
  });
}

// 获取保养计划列表数据
export function GetEquipmentPlanList(params: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/plan/list',
    method: 'get',
    baseURL,
    params,
  });
}

// 新建设备保养单
export function PostMaintenanceEquipment(data: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/maintenance/list',
    method: 'post',
    baseURL,
    data,
  });
}

// 获取设备保养单
export function GetMaintenanceEquipment(params: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/maintenance/page',
    method: 'get',
    baseURL,
    params,
  });
}

// 获取设备保养单
export function GetMaintenanceEquipmentMain(params: { id: number }) {
  return ajaxService({
    url: '/equipment/maintain/repair/maintenance',
    method: 'get',
    baseURL,
    params,
  });
}

// 删除设备保养单
export function DelMaintenanceEquipment(params: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/maintenance/list',
    method: 'delete',
    baseURL,
    params,
  });
}

// 编辑设备保养单
export function PutMaintenanceEquipment(data: any) {
  return ajaxService({
    url: '/equipment/maintain/repair/maintenance/list',
    method: 'put',
    baseURL,
    data,
  });
}
